const app = getApp();
var util = require('../../../utils/util.js')
var http = require('../../../utils/server.js')
Page({
  data: {
    height: 20,
    focus: false,
    isTop: 0,
    items: [{
      name: 'TOP',
      value: '置顶',
      checked: 'true'
    }, ]
  },
  bindFormSubmit: function(e) {
    console.log(e.detail.value.textarea)
    var that = this;
    http.post({
      url: "Index/publishNotice",
      content: e.detail.value.textarea,
      is_top: that.data.isTop
    }, function(data) {
      util.showSuccess('发布成功', function() {
        wx.navigateBack({
          delta: 1
        })
      })
    })
  },
  checkboxChange: function(e) {
    var that = this
    var isTop = 0
    if (e.detail.value.length > 0)
      isTop = 1
    that.setData({
      isTop: isTop
    })
  },
})